From 285e67c044d11e72f5fcc312b1d84ec547a072b3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 2 Apr 2019 21:50:09 +0000 Subject: [PATCH] inspector: Drop the class hierarchy page This was just not useful enough to keep around. --- gtk/inspector/init.c | 2 - gtk/inspector/meson.build | 1 - gtk/inspector/object-hierarchy.c | 130 ------------------------------ gtk/inspector/object-hierarchy.h | 59 -------------- gtk/inspector/object-hierarchy.ui | 43 ---------- gtk/inspector/window.c | 3 - gtk/inspector/window.ui | 9 --- 7 files changed, 247 deletions(-) delete mode 100644 gtk/inspector/object-hierarchy.c delete mode 100644 gtk/inspector/object-hierarchy.h delete mode 100644 gtk/inspector/object-hierarchy.ui diff --git a/gtk/inspector/init.c b/gtk/inspector/init.c index dd10edb34a..51360e7c1c 100644 --- a/gtk/inspector/init.c +++ b/gtk/inspector/init.c @@ -36,7 +36,6 @@ #include "magnifier.h" #include "menu.h" #include "misc-info.h" -#include "object-hierarchy.h" #include "object-tree.h" #include "prop-list.h" #include "recorder.h" @@ -71,7 +70,6 @@ gtk_inspector_init (void) g_type_ensure (GTK_TYPE_INSPECTOR_MAGNIFIER); g_type_ensure (GTK_TYPE_INSPECTOR_MENU); g_type_ensure (GTK_TYPE_INSPECTOR_MISC_INFO); - g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY); g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_TREE); g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST); g_type_ensure (GTK_TYPE_INSPECTOR_RECORDER); diff --git a/gtk/inspector/meson.build b/gtk/inspector/meson.build index 35b24c8de7..e0b740783a 100644 --- a/gtk/inspector/meson.build +++ b/gtk/inspector/meson.build @@ -20,7 +20,6 @@ inspector_sources = files( 'magnifier.c', 'menu.c', 'misc-info.c', - 'object-hierarchy.c', 'object-tree.c', 'prop-editor.c', 'prop-list.c', diff --git a/gtk/inspector/object-hierarchy.c b/gtk/inspector/object-hierarchy.c deleted file mode 100644 index 6acfea43ba..0000000000 --- a/gtk/inspector/object-hierarchy.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "config.h" -#include - -#include "object-hierarchy.h" - -#include "gtktreeselection.h" -#include "gtktreestore.h" -#include "gtktreeview.h" -#include "gtklabel.h" - - -enum -{ - COLUMN_OBJECT_NAME -}; - -struct _GtkInspectorObjectHierarchyPrivate -{ - GtkTreeStore *model; - GtkTreeView *tree; -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX) - -static void -gtk_inspector_object_hierarchy_init (GtkInspectorObjectHierarchy *oh) -{ - oh->priv = gtk_inspector_object_hierarchy_get_instance_private (oh); - gtk_widget_init_template (GTK_WIDGET (oh)); -} - -static void -gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/object-hierarchy.ui"); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model); - gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree); -} - -void -gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh, - GObject *object) -{ - GType type; - const gchar *class_name; - GtkTreeIter iter, parent; - GList *list = NULL, *l; - GHashTable *interfaces; - GHashTableIter hit; - GType *ifaces; - gint i; - - gtk_tree_store_clear (oh->priv->model); - - if (object == NULL) - return; - - interfaces = g_hash_table_new (g_str_hash, g_str_equal); - type = ((GTypeInstance*)object)->g_class->g_type; - - do - { - class_name = g_type_name (type); - list = g_list_append (list, (gpointer)class_name); - ifaces = g_type_interfaces (type, NULL); - for (i = 0; ifaces[i]; i++) - g_hash_table_add (interfaces, (gchar *)g_type_name (ifaces[i])); - g_free (ifaces); - } - while ((type = g_type_parent (type))); - - if (g_hash_table_size (interfaces) > 0) - { - gtk_tree_store_append (oh->priv->model, &iter, NULL); - gtk_tree_store_set (oh->priv->model, &iter, - COLUMN_OBJECT_NAME, "GInterface", - -1); - parent = iter; - } - g_hash_table_iter_init (&hit, interfaces); - while (g_hash_table_iter_next (&hit, (gpointer *)&class_name, NULL)) - { - gtk_tree_store_append (oh->priv->model, &iter, &parent); - gtk_tree_store_set (oh->priv->model, &iter, - COLUMN_OBJECT_NAME, class_name, - -1); - } - g_hash_table_unref (interfaces); - - list = g_list_reverse (list); - for (l = list; l; l = l->next) - { - gtk_tree_store_append (oh->priv->model, &iter, l == list ? NULL : &parent); - gtk_tree_store_set (oh->priv->model, &iter, - COLUMN_OBJECT_NAME, l->data, - -1); - parent = iter; - } - - g_list_free (list); - - gtk_tree_view_expand_all (oh->priv->tree); - gtk_tree_selection_select_iter (gtk_tree_view_get_selection (oh->priv->tree), &iter); -} - -// vim: set et sw=2 ts=2: diff --git a/gtk/inspector/object-hierarchy.h b/gtk/inspector/object-hierarchy.h deleted file mode 100644 index 961be2aa37..0000000000 --- a/gtk/inspector/object-hierarchy.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef _GTK_INSPECTOR_OBJECT_HIERARCHY_H_ -#define _GTK_INSPECTOR_OBJECT_HIERARCHY_H_ - -#include - -#define GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY (gtk_inspector_object_hierarchy_get_type()) -#define GTK_INSPECTOR_OBJECT_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchy)) -#define GTK_INSPECTOR_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass)) -#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY)) -#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY)) -#define GTK_INSPECTOR_OBJECT_HIERARCHY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass)) - - -typedef struct _GtkInspectorObjectHierarchyPrivate GtkInspectorObjectHierarchyPrivate; - -typedef struct _GtkInspectorObjectHierarchy -{ - GtkBox parent; - GtkInspectorObjectHierarchyPrivate *priv; -} GtkInspectorObjectHierarchy; - -typedef struct _GtkInspectorObjectHierarchyClass -{ - GtkBoxClass parent; -} GtkInspectorObjectHierarchyClass; - -G_BEGIN_DECLS - -GType gtk_inspector_object_hierarchy_get_type (void); -void gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh, - GObject *object); - -G_END_DECLS - -#endif // _GTK_INSPECTOR_OBJECT_HIERARCHY_H_ - -// vim: set et sw=2 ts=2: diff --git a/gtk/inspector/object-hierarchy.ui b/gtk/inspector/object-hierarchy.ui deleted file mode 100644 index c4be43048c..0000000000 --- a/gtk/inspector/object-hierarchy.ui +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index 716ca2e1e0..f58261dc07 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -32,7 +32,6 @@ #include "controllers.h" #include "css-editor.h" #include "css-node-tree.h" -#include "object-hierarchy.h" #include "object-tree.h" #include "size-groups.h" #include "data-list.h" @@ -71,7 +70,6 @@ set_selected_object (GtkInspectorWindow *iw, g_free (title); gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected); - gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected); gtk_inspector_misc_info_set_object (GTK_INSPECTOR_MISC_INFO (iw->misc_info), selected); gtk_inspector_css_node_tree_set_object (GTK_INSPECTOR_CSS_NODE_TREE (iw->widget_css_node_tree), selected); gtk_inspector_size_groups_set_object (GTK_INSPECTOR_SIZE_GROUPS (iw->size_groups), selected); @@ -318,7 +316,6 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, child_prop_list); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_css_node_tree); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_recorder); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_hierarchy); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_title); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, size_groups); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, data_list); diff --git a/gtk/inspector/window.ui b/gtk/inspector/window.ui index 3a77f55323..bf105b0f48 100644 --- a/gtk/inspector/window.ui +++ b/gtk/inspector/window.ui @@ -331,15 +331,6 @@ - - - hierarchy - Class Hierarchy - - - - - css-nodes -- 2.30.2